Imports cmplib01

Public Class frmConsumeResource
    Inherits System.Windows.Forms.Form

    Private ptrResource As ResourcePoolItem
    Private ptrCurrentGame As CampaignerGameData

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents pnlTopBorder As System.Windows.Forms.Panel
    Friend WithEvents picCampaignerIcon As System.Windows.Forms.PictureBox
    Friend WithEvents txtTitleBox As System.Windows.Forms.TextBox
    Friend WithEvents pnlFactionTwo As System.Windows.Forms.Panel
    Friend WithEvents lblFactionTwoDeployedPoints As System.Windows.Forms.Label
    Friend WithEvents txtAvailableAmount As System.Windows.Forms.TextBox
    Friend WithEvents lblFactionTwoPoints As System.Windows.Forms.Label
    Friend WithEvents txtUseAmount As System.Windows.Forms.TextBox
    Friend WithEvents lblFactionTwoName As System.Windows.Forms.Label
    Friend WithEvents txtResourceName As System.Windows.Forms.TextBox
    Friend WithEvents btnCancel As System.Windows.Forms.Button
    Friend WithEvents btnOk As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmConsumeResource))
        Me.pnlTopBorder = New System.Windows.Forms.Panel()
        Me.picCampaignerIcon = New System.Windows.Forms.PictureBox()
        Me.txtTitleBox = New System.Windows.Forms.TextBox()
        Me.btnCancel = New System.Windows.Forms.Button()
        Me.pnlFactionTwo = New System.Windows.Forms.Panel()
        Me.lblFactionTwoDeployedPoints = New System.Windows.Forms.Label()
        Me.txtAvailableAmount = New System.Windows.Forms.TextBox()
        Me.lblFactionTwoPoints = New System.Windows.Forms.Label()
        Me.txtUseAmount = New System.Windows.Forms.TextBox()
        Me.lblFactionTwoName = New System.Windows.Forms.Label()
        Me.txtResourceName = New System.Windows.Forms.TextBox()
        Me.btnOk = New System.Windows.Forms.Button()
        Me.pnlTopBorder.SuspendLayout()
        Me.pnlFactionTwo.SuspendLayout()
        Me.SuspendLayout()
        '
        'pnlTopBorder
        '
        Me.pnlTopBorder.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.pnlTopBorder.BackColor = System.Drawing.Color.SteelBlue
        Me.pnlTopBorder.Controls.AddRange(New System.Windows.Forms.Control() {Me.picCampaignerIcon, Me.txtTitleBox})
        Me.pnlTopBorder.Location = New System.Drawing.Point(-68, -2)
        Me.pnlTopBorder.Name = "pnlTopBorder"
        Me.pnlTopBorder.Size = New System.Drawing.Size(474, 40)
        Me.pnlTopBorder.TabIndex = 17
        '
        'picCampaignerIcon
        '
        Me.picCampaignerIcon.Image = CType(resources.GetObject("picCampaignerIcon.Image"), System.Drawing.Bitmap)
        Me.picCampaignerIcon.Location = New System.Drawing.Point(9, 11)
        Me.picCampaignerIcon.Name = "picCampaignerIcon"
        Me.picCampaignerIcon.Size = New System.Drawing.Size(16, 16)
        Me.picCampaignerIcon.TabIndex = 9
        Me.picCampaignerIcon.TabStop = False
        '
        'txtTitleBox
        '
        Me.txtTitleBox.BackColor = System.Drawing.Color.SteelBlue
        Me.txtTitleBox.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.txtTitleBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtTitleBox.ForeColor = System.Drawing.Color.WhiteSmoke
        Me.txtTitleBox.Location = New System.Drawing.Point(80, 8)
        Me.txtTitleBox.Multiline = True
        Me.txtTitleBox.Name = "txtTitleBox"
        Me.txtTitleBox.ReadOnly = True
        Me.txtTitleBox.Size = New System.Drawing.Size(328, 26)
        Me.txtTitleBox.TabIndex = 8
        Me.txtTitleBox.TabStop = False
        Me.txtTitleBox.Text = "Campaigner [Consume Resource]"
        '
        'btnCancel
        '
        Me.btnCancel.BackColor = System.Drawing.Color.LightSkyBlue
        Me.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnCancel.Location = New System.Drawing.Point(256, 208)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.TabIndex = 16
        Me.btnCancel.Text = "Cancel"
        '
        'pnlFactionTwo
        '
        Me.pnlFactionTwo.BackColor = System.Drawing.Color.LightSkyBlue
        Me.pnlFactionTwo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.pnlFactionTwo.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblFactionTwoDeployedPoints, Me.txtAvailableAmount, Me.lblFactionTwoPoints, Me.txtUseAmount, Me.lblFactionTwoName, Me.txtResourceName})
        Me.pnlFactionTwo.Location = New System.Drawing.Point(8, 46)
        Me.pnlFactionTwo.Name = "pnlFactionTwo"
        Me.pnlFactionTwo.Size = New System.Drawing.Size(328, 154)
        Me.pnlFactionTwo.TabIndex = 15
        '
        'lblFactionTwoDeployedPoints
        '
        Me.lblFactionTwoDeployedPoints.Location = New System.Drawing.Point(104, 118)
        Me.lblFactionTwoDeployedPoints.Name = "lblFactionTwoDeployedPoints"
        Me.lblFactionTwoDeployedPoints.Size = New System.Drawing.Size(97, 24)
        Me.lblFactionTwoDeployedPoints.TabIndex = 12
        Me.lblFactionTwoDeployedPoints.Text = "Available Amount"
        '
        'txtAvailableAmount
        '
        Me.txtAvailableAmount.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtAvailableAmount.Location = New System.Drawing.Point(208, 116)
        Me.txtAvailableAmount.Name = "txtAvailableAmount"
        Me.txtAvailableAmount.ReadOnly = True
        Me.txtAvailableAmount.Size = New System.Drawing.Size(112, 20)
        Me.txtAvailableAmount.TabIndex = 11
        Me.txtAvailableAmount.Text = "0"
        Me.txtAvailableAmount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'lblFactionTwoPoints
        '
        Me.lblFactionTwoPoints.Location = New System.Drawing.Point(104, 76)
        Me.lblFactionTwoPoints.Name = "lblFactionTwoPoints"
        Me.lblFactionTwoPoints.Size = New System.Drawing.Size(96, 24)
        Me.lblFactionTwoPoints.TabIndex = 10
        Me.lblFactionTwoPoints.Text = "Amount To Use"
        '
        'txtUseAmount
        '
        Me.txtUseAmount.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtUseAmount.Location = New System.Drawing.Point(208, 74)
        Me.txtUseAmount.Name = "txtUseAmount"
        Me.txtUseAmount.Size = New System.Drawing.Size(112, 20)
        Me.txtUseAmount.TabIndex = 9
        Me.txtUseAmount.Text = "0"
        Me.txtUseAmount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'lblFactionTwoName
        '
        Me.lblFactionTwoName.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblFactionTwoName.Location = New System.Drawing.Point(16, 8)
        Me.lblFactionTwoName.Name = "lblFactionTwoName"
        Me.lblFactionTwoName.Size = New System.Drawing.Size(216, 24)
        Me.lblFactionTwoName.TabIndex = 3
        Me.lblFactionTwoName.Text = "Resource"
        '
        'txtResourceName
        '
        Me.txtResourceName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtResourceName.Location = New System.Drawing.Point(16, 32)
        Me.txtResourceName.Name = "txtResourceName"
        Me.txtResourceName.ReadOnly = True
        Me.txtResourceName.Size = New System.Drawing.Size(304, 20)
        Me.txtResourceName.TabIndex = 3
        Me.txtResourceName.Text = "Some Resource"
        '
        'btnOk
        '
        Me.btnOk.BackColor = System.Drawing.Color.LightSkyBlue
        Me.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnOk.Location = New System.Drawing.Point(176, 208)
        Me.btnOk.Name = "btnOk"
        Me.btnOk.TabIndex = 18
        Me.btnOk.Text = "OK"
        '
        'frmConsumeResource
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.Black
        Me.ClientSize = New System.Drawing.Size(338, 240)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnOk, Me.pnlTopBorder, Me.btnCancel, Me.pnlFactionTwo})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.Name = "frmConsumeResource"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.pnlTopBorder.ResumeLayout(False)
        Me.pnlFactionTwo.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public Sub New(ByRef res As ResourcePoolItem, ByRef currentGame As CampaignerGameData)

        Me.New()

        ptrResource = res
        ptrCurrentGame = currentGame
        PopulateInfo()

    End Sub

    Private Sub PopulateInfo()

        'txtResourceName.Text = ptrResource.ResourceName
        'txtAvailableAmount.Text = ptrResource.CurrentAmount

    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        ' consume the resource and hide the form
        'Dim useAmount As Int32
        'Dim availAmount As Int32
        'Dim Levent As LogEvent

        'Try
        '    useAmount = CInt(txtUseAmount.Text)
        '    availAmount = CInt(txtAvailableAmount.Text)
        '    If useAmount > availAmount Then
        '        useAmount = availAmount
        '    End If
        '    ' reduce the amount and create a logevent
        '    ptrResource.CurrentAmount -= useAmount
        '    Levent = New LogEvent()
        '    Levent.AuthorityLevel = EventAuthorityLevel.ModeratorEvent
        '    Levent.InvokingPlayerName = ptrCurrentGame.selectedPlayer.PlayerName
        '    Levent.TurnNumber = ptrCurrentGame.Turn
        '    Levent.Action = "Used " & useAmount & " of " & ptrResource.ResourceName & "."

        '    ptrCurrentGame.LogEvents.Add(Levent.Key, Levent)

        'Catch ex As Exception

        'End Try

        Me.Hide()

    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Hide()

    End Sub
End Class
